﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SystemWFH.Domain;
using SystemWFH.Infrstructer.Interface;

namespace SystemWFH.Infrstructer.Impl
{
    public class EquipmentRepository:BaseRepository<Equipment>,IEquipmentRepository
    {
        public EquipmentRepository(SystemWFHDbContext wfContext) : base(wfContext) { }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="equipment"></param>
        /// <returns></returns>
        public async Task<int> AddedAsync(Equipment equipment)
        {
            try
            {
                return await base.Add(equipment);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="equipment"></param>
        /// <returns></returns>
        public async Task<int> UpdateAsync(Equipment equipment)
        {
            try
            {
                return await base.Update(equipment);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="equipmentId"></param>
        /// <returns></returns>
        public async Task<int> DeleteAsync(int equipmentId)
        {
            try
            {
                return await base.Delete(equipmentId);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        public async Task<List<Equipment>> GetAllAsync()
        {
            try
            {
                return await base.GetAll();
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id">ID</param>
        /// <returns></returns>
        public async Task<int> DeleteByIdAsync(int id)
        {
            try
            {
                return await base.Delete(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="equipmentId"></param>
        /// <returns></returns>
        public async Task<Equipment> GetByIdAsync(int equipmentId)
        {
            try
            {
                return await base.GetValue(equipmentId);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="equipmentId"></param>
        /// <returns></returns>
        public Task<int> EquipmentDeletePi(string equipmentId)
        {
            throw new NotImplementedException();
        }
    }
}
